<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProductImagesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('product_images', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('product_id')->comment('商品id -1:其他图片');
            $table->tinyInteger('type')->comment('图片类型 1：主图（轮播图） 2：详情图 3：活动图 4：商品分类图 5：首页轮播图');
            $table->string('path',250)->comment('图片路径');
            $table->integer('sort_number')->default(1)->comment('图片排序');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('product_images');
    }
}
